$(document).ready(function(){
	
	$( "#dialog-login" ).dialog({
			resizable: false,
			autoOpen: false,
			closeOnEscape: false,
			//height: 230,
			width: 350,
			modal: true,
			draggable: false,
			height: 'auto',
      		//width: 'auto',
			
			title:'<span class="ui-icon ui-icon-locked"></span>login Reselect E.I.R.L',
			hide: { effect: 'drop', direction: "down" } ,
			show: { effect: 'drop', direction: "up" },
			buttons: {
				"Aceptar": function() {
					ValidarUser();
				},
				//"Cancel":function() {
			
					//self.close()
					//$( this ).dialog( "close" );
					
				//}
			},
			close: function() {
				self.close()
				//window.close();
				////allFields.val( "" ).removeClass( "ui-state-error" );
			},
			create : function(){
				//$(".ui-widget-header").hide();
				$('.ui-dialog-titlebar-close').hide();
				$(this).parent().find('.ui-dialog-buttonpane button:first-child').button({
                                icons: { primary: 'ui-icon-key' }
                });
                //$(this).parent().find('.ui-dialog-buttonpane button:first-child').next().button({
                //    icons: { primary: 'ui-icon-circle-close' }
                //});
			},
			open: function () {
                            
                        }
		});
		
});

function ValidarUser(){
	 puser=$('#txt_user').val();
	 ppasswd=$('#txt_contra').val();
	 
	 	$.ajax({
 		dataType: "html",
	 	type: "POST",
	 	url: jQuery.scriptPath +'index.php/Index/valuser/',
	 	data: "puser="+puser+"&ppasswd="+ppasswd,
		success: function(requestData){
			$("#msgvalidate").html(requestData);
		},		
		error: function(requestData, strError, strTipoError){											
			$("#msgvalidate").html("Error " + strTipoError +": " + strError);
		}
		});
}


